<!DOCTYPE html>
<html lang="en">
{% load custom %}
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Blog Post - Start Bootstrap Template</title>

    <!-- Bootstrap Core CSS -->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
    <!-- Custom CSS -->
    <link href="/static/css/blog-post.css" rel="stylesheet">
    <link href="/static/css/custom.css" rel="stylesheet">
    <link href="/static/css/bootstrap.vertical-tabs.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    {% block head-css %}
    {% endblock %}

</head>

<body>
    {% csrf_token %}
    <!-- Navigation -->
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">

            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">草榴社区</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul id="top_menu" class="nav navbar-nav">
                    <li>
                        <a href="/">综合区</a>
                    </li>
                    <li>
                        <a href="{% url 'life' %}">欧美专区</a>
                    </li>
                    <li>
                        <a href="{% url 'tech' %}">日韩专区</a>
                    </li>
                    <li>
                        <a href="{% url 'category1024' %}">港澳台</a>
                    </li>
                    <li>
                        <a href="{% url 'chat' %}">聊天室</a>
                    </li>
                    <li>
                        <a href="{% url 'web_qq_dashboard' %}">WEB QQ</a>
                    </li>
                </ul>

                <ul class="nav navbar-nav navbar-right">
                    {% if request.user.is_authenticated %}
                    <li>
                        <a href="#">{{ request.user.userprofile.name }}</a>
                    </li>
                    {% else %}
                    <li>
                        <a href="{% url 'login' %}">登录/注册</a>
                    </li>
                    {% endif %}

                </ul>

            </div>
            <!-- /.navbar-collapse -->

        </div>
        <!-- /.container -->
    </nav>

    <!-- Page Content -->
    {% block page-container %}
    <div class="container">
        {% block container %}
        <div class="row">

            <!-- Blog Post Content Column -->
            <div class="col-lg-8">
                {% block content-left %}
                <!-- Blog Post -->
                <div class="hide new_bbs_reminder">
                <span> </span>条新消息入榜,点击查看
                </div>
                {% for article in articles %}

                <div bbs_id="{{ article.id }}" class="row bbs-summary-box ">
                    <div class="bbs-summary-box-img col-md-3">

                         <img src="/static/imgs/{{ article.head_img }}"/>
                    </div>
                    <div class="bbs-summary-box-summary">

                         <h4><a href="{%  url 'article' article.id %}" target="_blank">{{ article.title }}</a></h4>
                        <h3>{{ article.title | upper }}</h3>

                         <div class="bbs-summary-box-summary-btn">
                             <a href="#">{{ article.author.name }}</a>
                             <span class="glyphicon glyphicon-time"></span> {{ article.publish_date }}
                             <span class="glyphicon glyphicon-comment"></span> {{ article.comment_set.select_related.count }}
                             <span class="glyphicon glyphicon-star"></span> {{ article.thumb_set.select_related.count }}

                         </div>
                         <p>{{ article.breif }}</p>

                    </div>

                </div> <!-- end bbs-summary-box  -->

                <hr>
                {% endfor %}

                <div class="pagination">
                        {% if articles.number != articles.paginator.page_range.0 %}
                            <a href="?page=1"><span class="page_num">首页</span></a>
                        {% endif %}
                        {% for page_num in articles.paginator.page_range %}

                                {%  abs_compare  page_num articles.number %}

                        {% endfor %}
                        {% if articles.number != articles.paginator.page_range.last %}
                            <a href="?page={{ articles.paginator.page_range.last }}"><span class="page_num">最后页</span></a>
                        {% endif %}

                </div>



                {% endblock %}
            </div>


            <!-- Blog Sidebar Widgets Column -->
            <div class="col-md-4">
                {% block content-right %}
                <!-- Blog Search Well -->
                <div class="well">
                    <h4>Blog Search</h4>
                    <div class="input-group">
                        <input type="text" class="form-control">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="button">
                                <span class="glyphicon glyphicon-search"></span>
                        </button>
                        </span>
                    </div>
                    <!-- /.input-group -->
                </div>

                <!-- Blog Categories Well -->
                <div class="well">
                    <h4>Blog Categories</h4>
                    <div class="row">
                        <div class="col-lg-6">
                            <ul class="list-unstyled">
                                <li><a href="#">Category Name</a>
                                </li>
                                <li><a href="#">Category Name</a>
                                </li>
                                <li><a href="#">Category Name</a>
                                </li>
                                <li><a href="#">Category Name</a>
                                </li>
                            </ul>
                        </div>
                        <div class="col-lg-6">
                            <ul class="list-unstyled">
                                <li><a href="#">Category Name</a>
                                </li>
                                <li><a href="#">Category Name</a>
                                </li>
                                <li><a href="#">Category Name</a>
                                </li>
                                <li><a href="#">Category Name</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- /.row -->
                </div>

                <!-- Side Widget Well -->
                <div class="well">
                    <h4>Side Widget Well</h4>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore, perspiciatis adipisci accusamus laudantium odit aliquam repellat tempore quos aspernatur vero.</p>
                </div>
                {% endblock %}
            </div>

        </div>
        <!-- /.row -->

        <hr>
        {% endblock %}
        <!-- Footer -->
        <footer>
            <div class="row">
                <div class="col-lg-12">
                    <p>Copyright &copy; Your Website 2014</p>
                </div>
            </div>
            <!-- /.row -->
        </footer>

    </div>
    {% endblock %}
    <!-- /.container -->

    <!-- jQuery -->
    <script src="/static/js/jquery.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/static/js/bootstrap.min.js"></script>
    {% block bottom-js %}
    <script type="text/javascript">
        $(document).ready(function(){

            refreshBlog = setInterval(function(){
                var latest_bbs_ele = $(".bbs-summary-box")[0];


                $.get("{% url 'get_latest_bbs_id' %}",function(callback){

                    var new_bbs_count = callback - $(latest_bbs_ele).attr("bbs_id");
                    if (new_bbs_count > 0){

                        $(".new_bbs_reminder").removeClass("hide");
                        $(".new_bbs_reminder span").html(new_bbs_count);
                    }
                });//end get

            },30000);

        });//end doc ready


    </script>

    {% endblock %}
<script type="text/javascript">

    $(document).ready(function(){

        $("#top_menu a").each(function(){

            if ($(this).attr("href") == "{{ request.path }}"){
                $(this).parent().addClass("active");
            };
        });//end each

        /*

        */






    });// end doc ready

</script>

</body>

</html>
